{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}

<form class="layui-form p-4">
    <table class="layui-table layui-table-form">
        <tr>
            <td class="layui-td-gray">默认仓库
            </td>
            <td>
                <select name="warehouse_id" id="warehouse_id" lay-filter="warehouse_id">
                    <option value="">请选择</option>
                    {volist name='warehouse' id='wh'}
                    <option value="{$wh.id}" {if isset($detail.warehouse_id)&&$detail.warehouse_id==$wh.id} selected {/if}>{$wh.name}</option>
                    {/volist}
                </select>
            </td>
        </tr>

    </table>
    <div class="py-3">
        <input type="hidden" name="id" value="{$id}">
        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
    const moduleInit = ['tool'];

    function gouguInit() {
        var form = layui.form, tool = layui.tool, level = 0,upload = layui.upload;
        //监听提交
        form.on('submit(webform)', function (data) {
            form.on('select(pid)', function (data) {
                level = data.elem[data.elem.selectedIndex].title;
            })
            let callback = function (e) {
                layer.msg(e.msg);
                if (e.code == 0) {
                    setTimeout(function () {
                        parent.parent.location.reload();
                    }, 1000);
                }
            }
            tool.post("{:url('changeCk')}", data.field, callback);
            return false;
        });


    }

</script>
{/block}
<!-- /脚本 -->